hospitalizethegamefandomcom-20200213-history
Modding
Wish to create your own content for Hospitalize, AND share it with others? Modding with let you do just that! Creating mods can be done by anyone, no matter your programatic background. Using a simple language called XML, you will be able to change almost anything in the game and implement your very own creations. From character behaviour to diseases and treatments. Getting Started: Tutorial *To get started with creating your own mod, you first need to create a folder with some files in it. Start out by navigating to your Hospitalize install location. (That is the folder containing Hospitalize.exe. The default location is "'C:\Program Files (x86)\Steam\steamapps\common\Hospitalize'") *Once there, navigate to "Hospitalize_Data/StreamingAssets/Mods". This is where you want to put your mod folder. Let's create a new folder and call it whatever you want. In this example, we will be creating the grim reaper, so we are going to call the folder "The Grim Reaper". Open the folder you just created. Next, open your text editor of choice. (In this guide, we will be using Notepad++.) Create a new file in your text editor, and add the following: (Save this file as "'mod.data")'' *Now we need to actually create the grim reaper and all of its uses. To begin with, create a new file in your text editor and save it as "mod.xml" in the SAME directory as your "mod.data" file. The "mod.xml" file will contain all of the grim reaper's actions and attributes. Let's start filling that in. *Begin by creating a resource node with the name of your mod. Within this node, you can start setting up essential assets to your mod like sounds, graphics, etc. Let's try setting up a texture for our grim reaper by adding the "texturemap" node. In our case, it would look somthing like this: Note that you actually need to have the png file in your mod folder. You can chose to create your own texture or simply use the one I created: *Next, create a new node to put your character data in, like so: Let's start by giving our new character a name using the "name" node. In our case, it would look somthing like this: *Now, let's add some definitions as to what this character actually is. For this, we will use a couple of nodes. You might ask yourself "What is an entity?" In Hospitalize, an Entity is a character that is not spawnable by traditional means (Though the hiring menu), and thus they need to be spawned in some other way. To do that, we need to add the "frequency" node in addition to these other nodes. In our case, these should look something like this: Next, we will add a couple more nodes to define what the player can do with this character. showskills - Can you see this characters' skills when selecting it (true/false) showsalary - Can you see this characters' salary when selecting it (true/false) showtask - Can you see this characters' current activity when selecting it (true/false) canfire - Can you fire this character (true/false) In this case, I want all of the fields above to be false. Now, let's actually give our character some graphics. To do this, we first need to load a sprite for our character by using the "sprite" node. sprite - The name of this sprite (string) textureMap - The name of the texture map you want to use for this sprite (string) mapLocation - The location and dimensions of the sprite on the character sheet starting in the bottom left corner (x;y;w;h) unitToPixel - A scale factor. The default for hospitalize is 192. (int) offset - The offset of the sprite to the center of the character. (x;y;z) In our case, it would look somthing like this: Next, we need to tell the character which sprite to use depending on the direction he is facing. We do this by adding "objectview" nodes. objectview - The name of this view, following a specific naming pattern. dir - The direction this view is for (n/e/s/w) sprite - The sprite to use for this direction footprint - 16 bits, representing a 4x4 grid, which defines which part of this object obstruct pathfinding. (0000000000000000) flipxaxis - Flip the sprite on the X axis (true/false) flipyaxis - Flip the sprite on the Y axis (true/false) transparency - The transparency of this object view (0 - 1) The naming pattern for the objectview is as follows: BODYPART_KEYWORD_DIRECTION The body part if either body or head. The keyword is "normal" by default. The player can add more keywords to toggle different "states" of the sprite, e.g. the cleaner sweeping the floor. The direction refers to the direction of this object view. Let's add 4 of these object views to account for all 4 directions a character can move. Note that I have only made 1 sprite for the reaper, but in theory you could create an individual sprite for each direction. Your entire code should at this point look somewhat like this: https://i.imgur.com/f8vFYrf.png At this point, you could go ahead and test your mod. For testing purposes, you should increase the spawning frequency to something higher like 1. Start up your game, and go into the mods menu. If everything went well, your mod should show up in the list and you should be able to tick the check box next to it. After pressing the "back" button, the game will reload and your mod is enabled. Upon starting a new game, you should now see your grim reapers spawn. Great! The reaper is in the game! However, he doesn't really do much yet.. Let's try to add some functionality to our reaper! To do that, we need to create a task for him. Start by creating a new node under your "ReaperChar" node. [ ... ] ' ' ''' Now, just like we did for the reaper, we need to specify a name for this blueprint, and some extra nodes telling the game what this blueprint is. In this case, a task. task - Defines if this blueprint is a task (true/false) personaltask - Defines if this blueprint is a task that should be executed for personal reasons (true/false) taskQueue - The queue of this task. For medical stuff such as treatments use "Medical". Otherwise, use "Cleaning". taskBasePriority - The priority of this personal task for this character. (0-100) In our case, our task should now look somewhat like this: In this case, we set "personalTask" to false, since there is no personal reason we need this task to cover. In order for our task to actually do anything, we need to add some actions to tell the game what to do. Note that this is a very basic example. See the documentation page for actions for more info. LINK TO PAGE HERE action - The action to execute. nr - The index of this action. Leave this as auto. primary, secondary and tertiary - Three variables to pass into this action text - The text that will be shown as the current activity pre - What action needs to be finished for this to execute. Leave this as auto. In this example, I will be using 6 simple actions to create the reapers' behaviour. GetClosestPatient - Gets the patient closest to the task owner Move - Move Object A to location B Delay - Wait for a bit KillCharacter - Kill the closest character we found earlier MoveToRandomSpotInWorld - Move somehwere on the map RemoveCharacter - Remove the reaper from existence. In this example, my actions look something like this: https://i.imgur.com/s8rTQlz.png Finally, let's add a line to our ReaperChar node. This tells our reaper to automatically go ahead and reap souls of unknowing victims! Your entire mod.xml file should now look something like this: https://i.imgur.com/DEvlT7E.png With all of this completed, you can now go ahead and test your mod. The reaper should be flying around and killing innocent patients, before disappearing into the eather. As soon as you are ready to share your mod with the world: * Move your mod folder from the "StreamingAssets/Mods" folder to some other directory. * Open Hospitalize. * In the main menu, navigate to the "Mods -> Workshop" menu. * Click the "Create new item" button. * For the source folder, navigate into your mod folder (to the same directory where your mod.data is) * Enter a title for your mod. * Optionally, select and image, enter a description and change visability settings for your mod. * Hit the "Submit" button. * Congratulations! You can now subscribe to your mod from the steam workshop page. After restarting Hospitalize, your mod should be ready to go! Mod Example One: Usable Object The Red Oak mod is a very simple mod and is simply an additional tree to the already excisting bunch. Mod Example Two: Decorative Object Mod Example Three: Medical Object Mod Example Four: Disease Mod Example Five: Decorative Object Actions